﻿@{    
    Layout = "~/Views/Shared/_LayoutJtable.cshtml";  
}
@{ViewBag.Title = "Gestione Datos";
  int RoleId = ViewBag.RoleId;
  }


<div class="filtering"><form>
<label>Indroduzca texto para filtrar: <input type="text" name="filter" id="filter" /></label>
<button type="submit" id="LoadRecordsButton" class="button medium green">Filtrar Datos</button> 
    @Html.Hidden("RoleId", RoleId)
</form></div>
<div id="MyTableContainer"></div>

<script type="text/javascript">
     $(document).ready(function () {
     $('#MyTableContainer').jtable({
         title: 'DUA_Usuario',
         paging: true,
         pageSize: 20,
         sorting: true,
         defaultSorting: 'Id ASC',
         actions: {
             listAction: '@Url.Action("JSONPagedListByRol")'            
         },
         fields:
         {
          Id: {
                 key: true,
                 create: false,
                 edit: false,
                 list: false
             }
             ,
          UserName: {
                 title:'Nombre',
                 list: true                 
             }
             ,
          Password: {
                 title:'Contrasena',
                 list: true                 
             }
             ,
          Person: {
              title: 'Nombre Completo Persona',
                 list: true,                
             }            
             ,
          Locked: {
                 title:'Bloqueado',
                 list: true,
                 type: 'checkbox',
                 values:{'false':'NO','true':'Bloqueado'},
                 
          },
             ChangedPassword: {
                 title:'HaCambiadoContraseña',
             list: true,
             type: 'checkbox',
             values:{'false':'NO','true':'Cambiado'},             
             }
             ,
             Role: {
                 title: 'Role',
                 list: true                 
             }
             
            

},
formCreated: function (event, data) {data.form.validationEngine();},
formSubmitting: function (event, data) {return data.form.validationEngine('validate');},
formClosed: function (event, data) { data.form.validationEngine('hide'); data.form.validationEngine('detach'); }
});
$('#LoadRecordsButton').click(function (e) {e.preventDefault();$('#MyTableContainer').jtable('load', {filter: $('#filter').val(), roleId : $("#RoleId").val()  });});
$('#LoadRecordsButton').click();
});
</script>

